package com.temp.controller.user;

import com.temp.entity.Category;
import com.temp.result.Result;
import com.temp.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/category")
@Api(tags = "类别相关接口")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/query")
    @ApiOperation("用户获取类别信息")
    @RequiresPermissions("user:category:query")
    public Result userinfo() {
        List<Category> list = categoryService.list();
        return Result.success(list,"apiMsg.querySuccess");
    }
}
